home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Delphi Magazine Collection 2001
/
Delphi Magazine Collection 20001 (2001).iso
/
DISKS
/
Issue35
/
clinic
/
MainU.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1997-12-08
|
3KB
|
112 lines
unit MainU;
interface
uses
WinProcs, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Menus;
type
TForm1 = class(TForm)
MainMenu1: TMainMenu;
File1: TMenuItem;
Exit1: TMenuItem;
Help1: TMenuItem;
NewItem1: TMenuItem;
NewItem2: TMenuItem;
NewItem3: TMenuItem;
procedure NewItem1Click(Sender: TObject);
procedure NewItem2Click(Sender: TObject);
procedure NewItem3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.NewItem1Click(Sender: TObject);
begin
{ This loses the maximised MDI child system buttons }
Menu.Items.Insert(1, NewItem('New 1', 0, False, True, nil, 0, ''));
end;
procedure TForm1.NewItem2Click(Sender: TObject);
var
Flag: Boolean;
begin
Flag := ActiveMDIChild.WindowState = wsMaximized;
if Flag then
begin
{ Causes some flicker outside the app }
LockWindowUpdate(Handle);
ActiveMDIChild.WindowState := wsNormal;
end;
try
Menu.Items.Insert(1, NewItem('New 2', 0, False, True, nil, 0, ''))
finally
if Flag then
begin
ActiveMDIChild.WindowState := wsMaximized;
LockWindowUpdate(0)
end
end
end;
procedure TForm1.NewItem3Click(Sender: TObject);
{$ifdef Win32}
var
Flag, Animation: Boolean;
function GetAnimation: Boolean;
var
Info: TAnimationInfo;
begin
Info.cbSize := SizeOf(TAnimationInfo);
if SystemParametersInfo(SPI_GETANIMATION, SizeOf(Info), @Info, 0) then
Result := Info.iMinAnimate <> 0 else
Result := False;
end;
procedure SetAnimation(Value: Boolean);
var
Info: TAnimationInfo;
begin
Info.cbSize := SizeOf(TAnimationInfo);
BOOL(Info.iMinAnimate) := Value;
SystemParametersInfo(SPI_SETANIMATION, SizeOf(Info), @Info, 0);
end;
{$endif}
begin
{$ifdef Win32}
Flag := ActiveMDIChild.WindowState = wsMaximized;
Animation := GetAnimation;
if Flag then
begin
{ Causes some flicker inside the app }
if Animation then SetAnimation(False);
ActiveMDIChild.WindowState := wsNormal
end;
try
Menu.Items.Insert(1, NewItem('New 3', 0, False, True, nil, 0, ''))
finally
if Flag then
begin
ActiveMDIChild.WindowState := wsMaximized;
if Animation then SetAnimation(True)
end
end
{$else}
ShowMessage('This option is Win32 only')
{$endif}
end;
end.